*APSR replication material
*Title: Triggering Ideological Thinking: How Elections Foster Coherence of Welfare State Attitudes
*Author: Tobias Heide-Jørgensen

*PURPOSE: Reproducing results in terms of tables and figures from the supplementary material and online appendix.

*REQUIRED PACKAGES: estout mylabels


******************************							
*** Supplementary Material ***							
******************************				

*Reading data
use "replication_data.dta", clear

*Dropping respondents whose municipality id is based on zip codes in which 80% or less live in the municipality, as described in the article					
drop if prop_zipmun<=0.8

*Table H.1
foreach var of varlist male sec_edu hig_edu occu inc {
recode `var' (99 = .),gen(`var'_new)
}

tab ideo_group,gen(ideo_group)
tab occu_new,gen(occu_new)
tab inc_new,gen(inc_new)

qui eststo desc_stat: estpost sum redis taxwel ideo_group1 ideo_group2 ideo_group3 right_run right_above left_run left_above age male_new sec_edu_new hig_edu_new occu_new1 occu_new2 occu_new3 occu_new4 occu_new5 occu_new6 inc_new1 inc_new2 inc_new3 unemp socben anti_im crim plac_dev_avg
esttab desc_stat, cells("count mean(fmt(2)) sd(fmt(2)) min(fmt(2)) max(fmt(2))")

*Figure I.1
foreach num of numlist 15 10 5 {
qui: reg redis right_above##c.taxwel i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run if ideo_group==1 & prop_zipmun>=1, cluster(mun_id)							
estimate store l_propzip_full							
							
qui: reg redis right_above##c.taxwel i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run if inrange(right_run,-`num',`num') & ideo_group==1 & prop_zipmun>=1, cluster(mun_id)
estimate store l_propzip_`num'							
										
qui: reg redis left_above##c.taxwel i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year left_run c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run if ideo_group==3 & prop_zipmun>=1, cluster(mun_id)							
estimate store r_propzip_full							
							
qui: reg redis left_above##c.taxwel i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year left_run c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run if inrange(left_run,-`num',`num') & ideo_group==3 & prop_zipmun>=1, cluster(mun_id)							
estimate store r_propzip_`num'							
}					
							
mylabels 0 (0.05) 0.2, format(%04.3f) clean local(label_propzip)
						
coefplot l_propzip_full, bylabel("Full" "sample") || l_propzip_15, bylabel("+/-" "15 pp.") || l_propzip_10, bylabel("+/-" "10 pp.") || l_propzip_5, bylabel("+/-" "5 pp.") keep(1.right_above#c.taxwel) vertical yline(0, lpattern(dash)) bycoefs byopts(yrescale) ylabel(`label_propzip',grid angle(h) labsize(small)) xlabel(,labsize(small)) levels(95 90) plotregion(lcolor(white)) nokey mcolor(gs0) ciopts(color(gs12 gs8)) scheme(s1mono) graphregion(color(white)) ytitle(Effect of right-wing majority on consistency, size(small)) title("Leftists") saving(_left_propzip, replace) replace												

coefplot r_propzip_full, bylabel("Full" "sample") || r_propzip_15, bylabel("+/-" "15 pp.") || r_propzip_10, bylabel("+/-" "10 pp.") || r_propzip_5, bylabel("+/-" "5 pp.") keep(1.left_above#c.taxwel)  vertical nolabels yline(0, lpattern(dash)) bycoefs byopts(yrescale) ylabel(`label_propzip', grid angle(h) labsize(small)) xlabel(,labsize(small)) levels(95 90) nokey mcolor(gs0) ciopts(color(gs12 gs8)) scheme(s1mono) graphregion(color(white)) plotregion(lcolor(white)) ytitle(Effect of left-wing majority on consistency, size(small)) title("Rightists") saving(_right_propzip, replace) replace							
							
gr combine _left_propzip.gph _right_propzip.gph, graphregion(color(white)) ycommon

***********************							
*** Online Appendix ***							
***********************	

*** Individual-level analyses ***							
							
*Table A.1
foreach num of numlist 15 10 5/2 {
qui eststo lfull: reg redis right_above##c.taxwel i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run if ideo_group==1, cluster(mun_id)							
estadd local bandwidth "Full sample", replace							
							
qui eststo l`num': reg redis right_above##c.taxwel i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run if inrange(right_run,-`num',`num') & ideo_group==1, cluster(mun_id)						
estadd local bandwidth "+/- `num' pp.", replace	

qui eststo l17: reg redis right_above##c.taxwel i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run if inrange(right_run,-1.7,1.7) & ideo_group==1, cluster(mun_id)						
estadd local bandwidth "+/- 1.7 pp.", replace	
}
																		
esttab lfull l15 l10 l5 l4 l3 l2 l17, title(Welfare Attitude Crystallization among Leftists: Full Models) b(2) se starlevels(* 0.1 ** 0.05 *** 0.01) stats(bandwidth N, fmt(%9.0fc) label("Bandwidth" "Observations"))  label order(taxwel 1.right_above 1.right_above#c.taxwel)						

*Table A.2
foreach num of numlist 15 10 5/2 {
qui eststo rfull: reg redis left_above##c.taxwel i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year left_run c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run if ideo_group==3, cluster(mun_id)							
estadd local bandwidth "Full sample", replace							
							
qui eststo r`num': reg redis left_above##c.taxwel i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year left_run c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run if inrange(left_run,-`num',`num') & ideo_group==3, cluster(mun_id)							
estadd local bandwidth "+/- `num' pp.", replace	

qui eststo r17: reg redis left_above##c.taxwel i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year left_run c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run if inrange(left_run,-1.7,1.7) & ideo_group==3, cluster(mun_id)							
estadd local bandwidth "+/- 1.7 pp.", replace	
}

esttab rfull r15 r10 r5 r4 r3 r2 r17, title(Welfare Attitude Crystallization among Rightists: Full Models) b(2) se starlevels(* 0.1 ** 0.05 *** 0.01) stats(bandwidth N, fmt(%9.0fc) label("Bandwidth" "Observations"))  label order(taxwel 1.left_above 1.left_above#c.taxwel)							

*Figure B.1
foreach num of numlist 15 10 5 {
qui: reg redis left_above##c.taxwel i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year left_run c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run if ideo_group==1, cluster(mun_id)	
estimate store lp_full 							
							
qui: reg redis left_above##c.taxwel i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year left_run c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run if inrange(left_run,-`num',`num') & ideo_group==1, cluster(mun_id)							
estimate store lp_`num'							
														
qui: reg redis right_above##c.taxwel i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run if ideo_group==3, cluster(mun_id)							
estimate store rp_full 							
							
qui: reg redis right_above##c.taxwel i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run if inrange(right_run,-`num',`num') & ideo_group==3, cluster(mun_id)							
estimate store rp_`num'																			
}
						
mylabels -0.15 (0.05) 0.05, format(%04.3f) clean local(label_consonant)
							
coefplot lp_full, bylabel("Full" "sample") || lp_15, bylabel("+/-" "15 pp.") || lp_10, bylabel("+/-" "10 pp.") || lp_5, bylabel("+/-" "5 pp.") keep(1.left_above#c.taxwel) vertical yline(0, lpattern(dash)) bycoefs byopts(yrescale) ylabel(`label_consonant',grid angle(h) labsize(small)) xlabel(,labsize(small)) levels(95 90) nokey mcolor(gs0) ciopts(color(gs12 gs8)) plotregion(lcolor(white)) scheme(s1mono) graphregion(color(white)) ytitle(Effect of left-wing majority on consistency, size(small)) title("Leftists") saving(_left_consonant, replace) replace							
							
coefplot rp_full, bylabel("Full" "sample") || rp_15, bylabel("+/-" "15 pp.") || rp_10, bylabel("+/-" "10 pp.") || rp_5, bylabel("+/-" "5 pp.") keep(1.right_above#c.taxwel)  vertical yline(0, lpattern(dash)) bycoefs byopts(yrescale) ylabel(`label_consonant', grid angle(h) labsize(small)) xlabel(,labsize(small)) levels(95 90) nokey mcolor(gs0) ciopts(color(gs12 gs8)) plotregion(lcolor(white)) scheme(s1mono) graphregion(color(white)) ytitle(Effect of right-wing majority on consistency, size(small)) title("Rightists") saving(_right_consonant, replace) replace
							
gr combine _left_consonant.gph _right_consonant.gph, graphregion(color(white)) ycommon

*Figure B.2
foreach num of numlist 15 10 5 {
qui: reg redis right_above##c.taxwel i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run if ideo_group==2, cluster(mun_id) 							
estimate store crp_full 							
	
qui: reg redis right_above##c.taxwel i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run if inrange(right_run,-`num',`num') & ideo_group==2, cluster(mun_id) 							
estimate store crp_`num'							
										
qui: reg redis left_above##c.taxwel i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year left_run c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run if ideo_group==2, cluster(mun_id) 							
estimate store clp_full 							
							
qui: reg redis left_above##c.taxwel i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year left_run c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run if inrange(left_run,-`num',`num') & ideo_group==2, cluster(mun_id) 							
estimate store clp_`num'							
}
							
mylabels -0.15 (0.05) 0.1, format(%04.3f) clean local(label_centrist)
					
coefplot crp_full, bylabel("Full" "sample") || crp_15, bylabel("+/-" "15 pp.") || crp_10, bylabel("+/-" "10 pp.") || crp_5, bylabel("+/-" "5 pp.") keep(1.right_above#c.taxwel)  vertical yline(0, lpattern(dash)) bycoefs byopts(yrescale) ylabel(`label_centrist', grid angle(h) labsize(small)) xlabel(,labsize(small)) levels(95 90) nokey mcolor(gs0) ciopts(color(gs12 gs8)) plotregion(lcolor(white)) scheme(s1mono) graphregion(color(white)) ytitle(Effect of right-wing majority on consistency, size(small)) saving(_centrist_right, replace) replace							
							
coefplot clp_full, bylabel("Full" "sample") || clp_15, bylabel("+/-" "15 pp.") || clp_10, bylabel("+/-" "10 pp.") || clp_5, bylabel("+/-" "5 pp.") keep(1.left_above#c.taxwel) vertical yline(0, lpattern(dash)) bycoefs byopts(yrescale) ylabel(`label_centrist',grid angle(h) labsize(small)) xlabel(,labsize(small)) levels(95 90) nokey mcolor(gs0) ciopts(color(gs12 gs8)) plotregion(lcolor(white)) scheme(s1mono) graphregion(color(white)) ytitle(Effect of left-wing majority on consistency, size(small)) saving(_centrist_left, replace) replace							
							
gr combine _centrist_right.gph _centrist_left.gph, graphregion(color(white)) ycommon		

*Figure C.1
foreach num of numlist 15 10 5 {
qui: reg redis right_above##c.taxwel i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year right_run c.right_run#c.right_run c.right_run#c.right_run#c.right_run c.right_run#c.right_run#c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run right_above#c.right_run#c.right_run#c.right_run right_above#c.right_run#c.right_run#c.right_run#c.right_run if ideo_group==1, cluster(mun_id)			
estimate store left_higpol_full							
							
qui: reg redis right_above##c.taxwel i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year right_run c.right_run#c.right_run c.right_run#c.right_run#c.right_run c.right_run#c.right_run#c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run right_above#c.right_run#c.right_run#c.right_run right_above#c.right_run#c.right_run#c.right_run#c.right_run if inrange(right_run,-`num',`num') & ideo_group==1, cluster(mun_id)	
estimate store left_higpol_`num'							
							
qui: reg redis left_above##c.taxwel i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year left_run c.left_run#c.left_run c.left_run#c.left_run#c.left_run c.left_run#c.left_run#c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run left_above#c.left_run#c.left_run#c.left_run left_above#c.left_run#c.left_run#c.left_run#c.left_run if ideo_group==3, cluster(mun_id)	
estimate store right_higpol_full							
							
qui: reg redis left_above##c.taxwel i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year left_run c.left_run#c.left_run c.left_run#c.left_run#c.left_run c.left_run#c.left_run#c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run left_above#c.left_run#c.left_run#c.left_run left_above#c.left_run#c.left_run#c.left_run#c.left_run if inrange(left_run,-`num',`num') & ideo_group==3, cluster(mun_id)
estimate store right_higpol_`num'
}				
							
mylabels 0 (0.05) 0.2, format(%04.3f) clean local(label_higpol)
 							
coefplot left_higpol_full, bylabel("Full" "sample") || left_higpol_15, bylabel("+/-" "15 pp.") || left_higpol_10, bylabel("+/-" "10 pp.") || left_higpol_5, bylabel("+/-" "5 pp.") keep(1.right_above#c.taxwel) vertical yline(0, lpattern(dash)) bycoefs byopts(yrescale) ylabel(`label_higpol',grid angle(h) labsize(small)) xlabel(,labsize(small)) levels(95 90) nokey mcolor(gs0) plotregion(lcolor(white)) ciopts(color(gs12 gs8)) scheme(s1mono) graphregion(color(white)) ytitle(Effect of right-wing majority on consistency, size(small)) title("Leftists") saving(_left_higpol, replace)
						
coefplot right_higpol_full, bylabel("Full" "sample") || right_higpol_15, bylabel("+/-" "15 pp.") || right_higpol_10, bylabel("+/-" "10 pp.") || right_higpol_5, bylabel("+/-" "5 pp.") keep(1.left_above#c.taxwel)  vertical nolabels yline(0, lpattern(dash)) bycoefs byopts(yrescale) ylabel(`label_higpol', grid angle(h) labsize(small)) xlabel(,labsize(small)) levels(95 90) plotregion(lcolor(white)) nokey mcolor(gs0) ciopts(color(gs12 gs8)) scheme(s1mono) graphregion(color(white)) ytitle(Effect of left-wing majority on consistency, size(small)) title("Rightists") saving(_right_higpol, replace)													

gr combine _left_higpol.gph _right_higpol.gph, graphregion(color(white)) ycommon

*Table C.1
foreach num of numlist 45 55 {
gen left_run`num' = seat_left-`num'							
label var left_run`num' "Left placebo running variable (`num'%)"							
gen left_above`num' = 0							
replace left_above`num' = 1 if left_run`num'>0							
label var left_above`num' "Left placebo treatment (`num'%)"							

gen right_run`num' = seat_right-`num'							
label var right_run`num' "Right placebo running variable (`num'%)"							
gen right_above`num' = 0							
replace right_above`num' = 1 if right_run`num'>0							
label var right_above`num' "Right placebo treatment (`num'%)"	

qui eststo l_`num': reg redis right_above`num'##c.taxwel i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year right_run`num' c.right_run`num'#c.right_run`num' right_above`num'#c.right_run`num' right_above`num'#c.right_run`num'#c.right_run`num' if inrange(right_run`num',-5,5) & ideo_group==1, cluster(mun_id)
estadd local bandwidth "+/- 5 pp.", replace

qui eststo r_`num': reg redis left_above`num'##c.taxwel i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year left_run`num' c.left_run`num'#c.left_run`num' left_above`num'#c.left_run`num' left_above`num'#c.left_run`num'#c.left_run`num' if inrange(left_run`num',-5,5) & ideo_group==3, cluster(mun_id)							
estadd local bandwidth "+/- 5 pp.", replace	
}					
							
esttab l_45 l_55 r_45 r_55, title(Placebo Cutoffs) b(2) se starlevels(* 0.1 ** 0.05 *** 0.01) stats(bandwidth N, fmt(%9.0fc) label("Bandwidth" "Observations")) indicate("Covariates = *.inc" "Running variable = right_run45 right_run55 left_run45 left_run55") keep(taxwel 1.right_above45 1.right_above55 1.left_above45 1.left_above55 1.right_above45#c.taxwel 1.right_above55#c.taxwel 1.left_above45#c.taxwel 1.left_above55#c.taxwel _cons) label order(taxwel 1.right_above45 1.right_above55 1.left_above45 1.left_above55 1.right_above45#c.taxwel 1.right_above55#c.taxwel 1.left_above45#c.taxwel 1.left_above55#c.taxwel _cons)

*Table C.4					
recode sec_edu (99=.),gen(sec_edu_dum)							
recode hig_edu (99=.),gen(hig_edu_dum)							
recode inc (1 2=0) (3=1) (99=.),gen(inc_dum)							
recode occu (1=1) (99=.) (else=0),gen(occu_dum)							
recode male (99=.),gen(male_dum)							

foreach var of varlist male_dum sec_edu_dum hig_edu_dum inc_dum occu_dum {
qui eststo l_age: reg age right_above right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run if inrange(right_run,-10,10) & ideo_group==1, cluster(mun_id)	
estadd local bandwidth "+/- 10 pp.", replace

qui eststo l_`var': logit `var' right_above right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run if inrange(right_run,-10,10) & ideo_group==1, cluster(mun_id)
estadd local bandwidth "+/- 10 pp.", replace							
}													
													
esttab l_age l_male_dum l_sec_edu_dum l_hig_edu_dum l_inc_dum l_occu_dum, title(Individual Level Covariate Analysis: Leftists) b(2) se starlevels(* 0.1 ** 0.05 *** 0.01) stats(bandwidth N, fmt(%9.0fc) label("Bandwidth" "Observations")) indicate("Running variable = right_run") keep(right_above _cons) label order(right_above _cons)

*Table C.5				
foreach var of varlist male_dum sec_edu_dum hig_edu_dum inc_dum occu_dum {				
qui eststo r_age: reg age left_above left_run c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run if inrange(left_run,-10,10) & ideo_group==3, cluster(mun_id)		
estadd local bandwidth "+/- 10 pp.", replace							
							
qui eststo r_`var': logit `var' left_above left_run c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run if inrange(left_run,-10,10) & ideo_group==3, cluster(mun_id)	
estadd local bandwidth "+/- 10 pp.", replace							
}												
							
esttab r_age r_male_dum r_sec_edu_dum r_hig_edu_dum r_inc_dum r_occu_dum, title(Individual Level Covariate Analysis: Rightists) b(2) se starlevels(* 0.1 ** 0.05 *** 0.01) stats(bandwidth N, fmt(%9.0fc) label("Bandwidth" "Observations")) indicate("Running variable = left_run") keep(left_above _cons) label order(left_above _cons)

*Table C.6							
qui eststo l_donut: reg redis right_above##c.taxwel i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run if (inrange(right_run,-15,-3) | inrange(right_run,3,15)) & ideo_group==1, cluster(mun_id)
estadd local bandwidth "+/- 3-15 pp.", replace							
							
qui eststo r_donut: reg redis left_above##c.taxwel i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year left_run c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run if (inrange(left_run,-15,-3) | inrange(left_run,3,15)) & ideo_group==3, cluster(mun_id)	
estadd local bandwidth "+/- 3-15 pp.", replace							
						
esttab l_donut r_donut, title(Donut RDD) b(2) se starlevels(* 0.1 ** 0.05 *** 0.01) stats(bandwidth N, fmt(%9.0fc) label("Bandwidth" "Observations")) indicate("Covariates = *.inc" "Running variable = right_run left_run") keep(taxwel 1.left_above 1.right_above 1.left_above#c.taxwel 1.right_above#c.taxwel _cons) label order(taxwel 1.left_above 1.right_above 1.left_above#c.taxwel 1.right_above#c.taxwel _cons)							
*Table C.7
gen after_first=1							
replace after_first=0 if year-elec_year<2

foreach num of numlist 15 10 5 {
qui eststo r_self_full: reg redis left_above##c.taxwel##i.after_first i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year left_run c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run if ideo_group==3, cluster(mun_id)							
estadd local bandwidth "Full sample", replace							
							
qui eststo r_self_`num': reg redis left_above##c.taxwel##i.after_first i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year left_run c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run if inrange(left_run,-`num',`num') & ideo_group==3, cluster(mun_id)			
estadd local bandwidth "+/- `num' pp.", replace							
}						
														
esttab r_self_full r_self_15 r_self_10 r_self_5, title(Effect Heterogeneity by Time: Rightists) b(2) se starlevels(* 0.1 ** 0.05 *** 0.01) stats(bandwidth N, fmt(%9.0fc) label("Bandwidth" "Observations")) indicate("Covariates = *.inc" "Running variable = left_run") keep(taxwel 1.left_above 1.after_first 1.left_above#c.taxwel 1.after_first#c.taxwel 1.left_above#1.after_first 1.left_above#1.after_first#c.taxwel _cons) label order(taxwel 1.left_above 1.after_first 1.left_above#c.taxwel 1.after_first#c.taxwel 1.left_above#1.after_first 1.left_above#1.after_first#c.taxwel _cons)	

*Table C.8
foreach num of numlist 15 10 5 {
eststo l_self_full: reg redis right_above##c.taxwel##i.after_first i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run if ideo_group==1, cluster(mun_id)							
estadd local bandwidth "Full sample", replace							
							
eststo l_self_`num': reg redis right_above##c.taxwel##i.after_first i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run if inrange(right_run,-`num',`num') & ideo_group==1, cluster(mun_id)
estadd local bandwidth "+/- `num' pp.", replace							
}						
							
esttab l_self_full l_self_15 l_self_10 l_self_5, title(Effect Heterogeneity by Time: Leftists) b(2) se starlevels(* 0.1 ** 0.05 *** 0.01) stats(bandwidth N, fmt(%9.0fc) label("Bandwidth" "Observations")) indicate("Covariates = *.inc" "Running variable = right_run") keep(taxwel 1.right_above 1.after_first 1.right_above#c.taxwel 1.after_first#c.taxwel 1.right_above#1.after_first 1.right_above#1.after_first#c.taxwel _cons) label order(taxwel 1.right_above 1.after_first 1.right_above#c.taxwel 1.after_first#c.taxwel 1.right_above#1.after_first 1.right_above#1.after_first#c.taxwel _cons)

*Figure C.4
foreach num of numlist 15 10 5 {
qui: reg redis right_above##c.taxwel##i.after_first i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run if ideo_group==1, cluster(mun_id)							
estimate store l_within_full 							
							
qui: reg redis right_above##c.taxwel##i.after_first i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run if inrange(right_run,-`num',`num') & ideo_group==1, cluster(mun_id)				
estimate store l_within_`num'											
							
qui: reg redis right_above##c.taxwel##ib(1).after_first i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run if ideo_group==1, cluster(mun_id)							
estimate store l_after_full 							
							
qui: reg redis right_above##c.taxwel##ib(1).after_first i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run if inrange(right_run,-`num',`num') & ideo_group==1, cluster(mun_id)	
estimate store l_after_`num' 							
}						
							
mylabels -0.1 (0.1) 0.3, format(%04.3f) clean local(label_after_first)
 							
coefplot l_within_full l_after_full, bylabel("Full" "sample") || l_within_15 l_after_15, bylabel("+/-" "15 pp.") || l_within_10 l_after_10, bylabel("+/-" "10 pp.") || l_within_5 l_after_5, bylabel("+/-" "5 pp.") keep(1.right_above#c.taxwel)  vertical yline(0, lpattern(dash)) bycoefs byopts(yrescale) ylabel(`label_after_first', grid angle(h) labsize(small)) xlabel(,labsize(small)) levels(95 90) p1(label(Within one year)) p2(label(After one year)) plotregion(lcolor(white)) mcolor(gs0) ciopts(color(gs12 gs8)) scheme(s1mono) graphregion(color(white)) ytitle(Effect of right-wing majority on consistency, size(small)) title("")	

*Figure D.1						
gen time=year-elec_year					

foreach num of numlist 2/4 {
qui: reg redis right_above##c.taxwel##time i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run if inrange(right_run,-10,10) & ideo_group==1, cluster(mun_id) 							
estimate store l_time1 	

qui: reg redis right_above##c.taxwel##ib(`num').time i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run if inrange(right_run,-10,10) & ideo_group==1, cluster(mun_id) 							
estimate store l_time`num'

qui: reg redis left_above##c.taxwel##i.time i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year left_run c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run if inrange(left_run,-10,10) & ideo_group==3, cluster(mun_id) 									
estimate store r_time1

qui: reg redis left_above##c.taxwel##ib(`num').time i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year left_run c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run if inrange(left_run,-10,10) & ideo_group==3, cluster(mun_id) 									
estimate store r_time`num'
}		
	
mylabels -0.3 (0.1) 0.2, format(%04.3f) clean local(time) 	
						
coefplot l_time1, bylabel("Within" "1 year") || l_time2, bylabel("After 1-2" "years") || l_time3, bylabel("After 2-3" "years") || l_time4, bylabel("After 3-4" "years") keep(1.right_above#c.taxwel)  vertical yline(0, lpattern(dash)) bycoefs byopts(yrescale) ylabel(`time', grid angle(h) labsize(small)) xlabel(,labsize(small)) levels(95 90) plotregion(lcolor(white)) mcolor(gs0) ciopts(color(gs12 gs8)) scheme(s1mono) graphregion(color(white)) ytitle(Effect of right-wing majority on consistency, size(small)) title(Leftists) saving(Effect_last_leftists, replace)	
						
coefplot r_time1, bylabel("Within" "1 year") || r_time2, bylabel("After 1-2" "years") || r_time3, bylabel("After 2-3" "years") || r_time4, bylabel("After 3-4" "years") keep(1.left_above#c.taxwel)  vertical yline(0, lpattern(dash)) bycoefs byopts(yrescale) ylabel(`time', grid angle(h) labsize(small)) xlabel(,labsize(small)) levels(95 90) plotregion(lcolor(white)) mcolor(gs0) ciopts(color(gs12 gs8)) scheme(s1mono) graphregion(color(white)) ytitle(Effect of left-wing majority on consistency, size(small)) title(Rightists) saving(Effect_last_rightists, replace)									

gr combine Effect_last_leftists.gph Effect_last_rightists.gph, graphregion(color(white)) ycommon
	
*Table D.1
qui eststo l_ageint: reg redis right_above##c.taxwel##c.age i.male i.inc i.sec_edu i.hig_edu i.occu i.year right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run if inrange(right_run,-10,10) & ideo_group==1, cluster(mun_id)							
estadd local bandwidth "+/- 10 pp.", replace							
							
qui eststo l_ageint_squre: reg redis right_above##c.taxwel##c.age##c.age i.male i.inc i.sec_edu i.hig_edu i.occu i.year right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run if inrange(right_run,-10,10) & ideo_group==1, cluster(mun_id)
estadd local bandwidth "+/- 10 pp.", replace							
						
testparm right_above#c.taxwel#c.age right_above#c.taxwel#c.age#c.age //Testing joint significance of age interactions.

esttab l_ageint l_ageint_squre, title(Does Age Moderate the Crystallization Effect?: Leftists) b(2) se starlevels(* 0.1 ** 0.05 *** 0.01) stats(bandwidth N, fmt(%9.0fc) label("Bandwidth" "Observations")) indicate("Covariates = *.inc" "Running variable = right_run") keep(taxwel 1.right_above age c.age#c.age 1.right_above#c.taxwel c.taxwel#c.age c.taxwel#c.age#c.age 1.right_above#c.age 1.right_above#c.age#c.age 1.right_above#c.taxwel#c.age 1.right_above#c.taxwel#c.age#c.age _cons) label order(taxwel 1.right_above age c.age#c.age 1.right_above#c.taxwel c.taxwel#c.age c.taxwel#c.age#c.age 1.right_above#c.age 1.right_above#c.age#c.age 1.right_above#c.taxwel#c.age 1.right_above#c.taxwel#c.age#c.age _cons)							

*Table D.2
qui eststo r_ageint: reg redis left_above##c.taxwel##c.age i.male i.inc i.sec_edu i.hig_edu i.occu i.year left_run c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run if inrange(left_run,-10,10) & ideo_group==3, cluster(mun_id) 							
estadd local bandwidth "+/- 10 pp.", replace							
							
qui eststo r_ageint_square: reg redis left_above##c.taxwel##c.age##c.age i.male i.inc i.sec_edu i.hig_edu i.occu i.year left_run c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run if inrange(left_run,-10,10) & ideo_group==3, cluster(mun_id) 							
estadd local bandwidth "+/- 10 pp.", replace							
							
testparm  left_above#c.taxwel#c.age left_above#c.taxwel#c.age#c.age //Testing joint significance of age interactions.						
														
esttab r_ageint r_ageint_square, title(Does Age Moderate the Crystallization Effect?: Rightists) b(2) se starlevels(* 0.1 ** 0.05 *** 0.01) stats(bandwidth N, fmt(%9.0fc) label("Bandwidth" "Observations")) indicate("Covariates = *.inc" "Running variable = left_run") keep(taxwel 1.left_above age c.age#c.age 1.left_above#c.taxwel c.taxwel#c.age c.taxwel#c.age#c.age 1.left_above#c.age 1.left_above#c.age#c.age 1.left_above#c.taxwel#c.age 1.left_above#c.taxwel#c.age#c.age _cons) label order(taxwel 1.left_above age c.age#c.age 1.left_above#c.taxwel c.taxwel#c.age c.taxwel#c.age#c.age 1.left_above#c.age 1.left_above#c.age#c.age 1.left_above#c.taxwel#c.age 1.left_above#c.taxwel#c.age#c.age _cons)						

*Table D.3
sum ideo if ideo_group==1,d							
gen left = (ideo-r(max))/(r(min)-r(max)) if ideo_group==1							
label var left "Left-wing orientation"							
							
qui eststo l_extr: reg redis right_above##c.taxwel##c.left i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run if inrange(right_run,-10,10) & ideo_group==1, cluster(mun_id)			
estadd local bandwidth "+/- 10 pp.", replace							

esttab l_extr, title(Does Ideological Extremity Moderate the Crystallization Effect?: Leftists) b(2) se starlevels(* 0.1 ** 0.05 *** 0.01) stats(bandwidth N, fmt(%9.0fc) label("Bandwidth" "Observations")) indicate("Covariates = *.inc" "Running variable = right_run") keep(taxwel 1.right_above left  1.right_above#c.taxwel c.taxwel#c.left 1.right_above#c.left 1.right_above#c.taxwel#c.left _cons) label order(taxwel 1.right_above left  1.right_above#c.taxwel c.taxwel#c.left 1.right_above#c.left 1.right_above#c.taxwel#c.left _cons)

*Table D.4
sum ideo if ideo_group==3,d							
gen right = (ideo-r(min))/(r(max)-r(min)) if ideo_group==3							
label var right "Right-wing orientation"							
							
qui eststo r_extr: reg redis left_above##c.taxwel##c.right i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year left_run c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run if inrange(left_run,-10,10) & ideo_group==3, cluster(mun_id) 							
estadd local bandwidth "+/- 10 pp.", replace												
							
esttab r_extr, title(Does Ideological Extremity Moderate the Crystallization Effect?: Rightists)b(2) se starlevels(* 0.1 ** 0.05 *** 0.01) stats(bandwidth N, fmt(%9.0fc) label("Bandwidth" "Observations")) indicate("Covariates = *.inc" "Running variable = left_run") keep(taxwel 1.left_above right 1.left_above#c.taxwel c.taxwel#c.right 1.left_above#c.right 1.left_above#c.taxwel#c.right _cons) label order(taxwel 1.left_above right 1.left_above#c.taxwel c.taxwel#c.right 1.left_above#c.right 1.left_above#c.taxwel#c.right _cons)	

*Table D.5
qui eststo l_soph: reg redis right_above##c.taxwel##c.plac_dev_avg i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run if inrange(right_run,-10,10) & ideo_group==1, cluster(mun_id)	
estadd local bandwidth "+/- 10 pp.", replace							

qui eststo r_soph: reg redis left_above##c.taxwel##c.plac_dev_avg i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year left_run c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run if inrange(left_run,-10,10) & ideo_group==3, cluster(mun_id)
estadd local bandwidth "+/- 10 pp.", replace							

esttab l_soph r_soph, title(Does Political Sophistication Moderate the Crystallization Effect?) b(2) se starlevels(* 0.1 ** 0.05 *** 0.01) stats(bandwidth N, fmt(%9.0fc) label("Bandwidth" "Observations")) indicate("Covariates = *.inc" "Running variable = right_run left_run") keep(taxwel 1.right_above 1.left_above plac_dev_avg c.taxwel#c.plac_dev_avg 1.right_above#c.taxwel 1.right_above#c.plac_dev_avg 1.right_above#c.taxwel#c.plac_dev_avg 1.left_above#c.taxwel 1.left_above#c.plac_dev_avg 1.left_above#c.taxwel#c.plac_dev_avg _cons) label order(taxwel 1.right_above 1.left_above plac_dev_avg c.taxwel#c.plac_dev_avg 1.right_above#c.taxwel 1.right_above#c.plac_dev_avg 1.right_above#c.taxwel#c.plac_dev_avg 1.left_above#c.taxwel 1.left_above#c.plac_dev_avg 1.left_above#c.taxwel#c.plac_dev_avg _cons)

*Figure D.2
foreach num of numlist 15 10 5/2 {
qui: reg unemp right_above##c.socben i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run if ideo_group==1, cluster(mun_id)							
estimate store l_unempsoc_full
							
qui: reg unemp right_above##c.socben i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run if inrange(right_run,-`num',`num') & ideo_group==1, cluster(mun_id)							
estimate store l_unempsoc_`num'										
							
qui: reg unemp right_above##c.socben i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run if inrange(right_run,-1.7,1.7) & ideo_group==1, cluster(mun_id)							
estimate store l_unempsoc_17							
														
qui: reg unemp left_above##c.socben i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year left_run c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run if ideo_group==3, cluster(mun_id)							
estimate store r_unempsoc_full							
							
qui: reg unemp left_above##c.socben i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year left_run c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run if inrange(left_run,-`num',`num') & ideo_group==3, cluster(mun_id)							
estimate store r_unempsoc_`num' 							
											
qui: reg unemp left_above##c.socben i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year left_run c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run if inrange(left_run,-1.7,1.7) & ideo_group==3, cluster(mun_id)							
estimate store r_unempsoc_17							
}							
							
mylabels -0.2 (0.1) 0.6, format(%04.3f) clean local(unempsoc)
							
coefplot l_unempsoc_full, bylabel("Full" "sample") || l_unempsoc_15, bylabel("+/-" "15 pp.") || l_unempsoc_10, bylabel("+/-" "10 pp.") || l_unempsoc_5, bylabel("+/-" "5 pp.") || l_unempsoc_4, bylabel("+/-" "4 pp.") || l_unempsoc_3, bylabel("+/-" "3 pp.") || l_unempsoc_2, bylabel("+/-" "2 pp.") || l_unempsoc_17, bylabel("+/-" "1.7 pp.") keep(1.right_above#c.socben) vertical yline(0, lpattern(dash)) bycoefs byopts(yrescale) ylabel(`unempsoc',grid angle(h) labsize(small)) xlabel(,labsize(small)) levels(95 90) nokey mcolor(gs0) plotregion(lcolor(white)) ciopts(color(gs12 gs8)) scheme(s1mono) graphregion(color(white)) ytitle(Effect of right-wing majority on consistency, size(small)) title("Leftists") saving(_left_unempsoc, replace)
														
coefplot r_unempsoc_full, bylabel("Full" "sample") || r_unempsoc_15, bylabel("+/-" "15 pp.") || r_unempsoc_10, bylabel("+/-" "10 pp.") || r_unempsoc_5, bylabel("+/-" "5 pp.") || r_unempsoc_4, bylabel("+/-" "4 pp.") || r_unempsoc_3, bylabel("+/-" "3 pp.") || r_unempsoc_2, bylabel("+/-" "2 pp.") || r_unempsoc_17, bylabel("+/-" "1.7 pp.") keep(1.left_above#c.socben)  vertical nolabels yline(0, lpattern(dash)) bycoefs byopts(yrescale) ylabel(`unempsoc', grid angle(h) labsize(small)) xlabel(,labsize(small)) levels(95 90) nokey mcolor(gs0) plotregion(lcolor(white)) ciopts(color(gs12 gs8)) scheme(s1mono) graphregion(color(white)) ytitle(Effect of left-wing majority on consistency, size(small)) title("Rightists") saving(_right_unempsoc, replace)					
							
gr combine _left_unempsoc.gph _right_unempsoc.gph, graphregion(color(white)) ycommon				

*Figure D.3
alpha redis taxwel unemp socben if inrange(right_run,-1.7,0) & ideo_group==1
gen alpha=r(alpha) if inrange(right_run,-1.7,0) & ideo_group==1

alpha redis taxwel unemp socben if inrange(right_run,0,1.7) & ideo_group==1
replace alpha=r(alpha) if inrange(right_run,0,1.7) & ideo_group==1

alpha redis taxwel unemp socben if inrange(left_run,-1.7,0) & ideo_group==3
replace alpha=r(alpha) if inrange(left_run,-1.7,0) & ideo_group==3

alpha redis taxwel unemp socben if inrange(left_run,0,1.7) & ideo_group==3
replace alpha=r(alpha) if inrange(left_run,0,1.7) & ideo_group==3
					
gen treat=0 if (right_above==0 & ideo_group==1) | (left_above==0 & ideo_group==3)
replace treat=1 if (right_above==1 & ideo_group==1) | (left_above==1 & ideo_group==3)

keep if (inrange(right_run,-1.7,1.7) & ideo_group==1) | (inrange(left_run,-1.7,1.7) & ideo_group==3)

gen gro = 1 if inrange(right_run,-1.7,0) & ideo_group==1
replace gro = 2 if inrange(right_run,0,1.7) & ideo_group==1
replace gro = 3 if inrange(left_run,-1.7,0) & ideo_group==3
replace gro = 4 if inrange(left_run,0,1.7) & ideo_group==3

bysort gro: keep if _n==_N
keep treat alpha ideo_group

label define treat 1 "Divergent majority" 0 "No divergent majority"
label value treat treat

gen alpha_label="0.32" if treat==0 & ideo_group==1
replace alpha_label="0.41" if treat==1 & ideo_group==1
replace alpha_label="0.06" if treat==0 & ideo_group==3
replace alpha_label="0.48" if treat==1 & ideo_group==3

mylabels 0 (0.1) 0.5, format(%04.3f) clean local(alpha)
							
dotplot alpha if ideo_group==1, over(treat) xscale(extend) yscale(extend) msymbol(circle) msize(medium) ytitle(Alpha, size(small)) xtitle("") title(Leftists) ylabel(`alpha',grid gmax gmin angle(h) labsize(small)) graphregion(color(white)) plotregion(lcolor(white)) mcolor(gs0) scheme(s1mono) plotregion(lcolor(white)) saving(alpha_left, replace) center mlabel(alpha_label)

dotplot alpha if ideo_group==3, over(treat) xscale(extend) yscale(extend) msymbol(circle) msize(medium) ytitle(Alpha, size(small)) xtitle("") title(Rightists) ylabel(`alpha',grid gmax gmin angle(h) labsize(small)) graphregion(color(white)) plotregion(lcolor(white)) mcolor(gs0) scheme(s1mono) plotregion(lcolor(white)) saving(alpha_right, replace) center mlabel(alpha_label)

gr combine alpha_left.gph alpha_right.gph, graphregion(color(white)) ycommon
							
*Figure D.4
use "replication_data.dta", clear //Reloading data
drop if prop_zipmun<=0.8

foreach num of numlist 15 10 5/2 {
qui: reg anti_im right_above##c.crim i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run if ideo_group==1, cluster(mun_id)	
estimate store l_cul_full							
						
qui: reg anti_im right_above##c.crim i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run if inrange(right_run,-`num',`num') & ideo_group==1, cluster(mun_id)	
estimate store l_cul_`num'								

qui: reg anti_im right_above##c.crim i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run if inrange(right_run,-1.7,1.7) & ideo_group==1, cluster(mun_id)
estimate store l_cul_17
	
qui: reg anti_im left_above##c.crim i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year left_run c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run if ideo_group==3, cluster(mun_id)
estimate store r_cul_full							
							
qui: reg anti_im left_above##c.crim i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year left_run c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run if inrange(left_run,-`num',`num') & ideo_group==3, cluster(mun_id)	
estimate store r_cul_`num'			
			
qui: reg anti_im left_above##c.crim i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year left_run c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run if inrange(left_run,-1.7,1.7) & ideo_group==3, cluster(mun_id)
estimate store r_cul_17
}

mylabels -0.4 (0.1) 0.4, format(%04.3f) clean local(cul)
						
coefplot l_cul_full, bylabel("Full" "sample") ||l_cul_15, bylabel("+/-" "15 pp.") || l_cul_10, bylabel("+/-" "10 pp.") || l_cul_5, bylabel("+/-" "5 pp.") || l_cul_4, bylabel("+/-" "4 pp.") || l_cul_3, bylabel("+/-" "3 pp.") || l_cul_2, bylabel("+/-" "2 pp.") || l_cul_17, bylabel("+/-" "1.7 pp.") keep(1.right_above#c.crim) vertical yline(0, lpattern(dash)) bycoefs byopts(yrescale) ylabel(`cul',grid angle(h) labsize(small)) xlabel(,labsize(small)) levels(95 90) nokey mcolor(gs0) plotregion(lcolor(white)) ciopts(color(gs12 gs8)) scheme(s1mono) graphregion(color(white)) ytitle(Effect of right-wing majority on consistency, size(small)) title("Leftists") saving(_left_cul, replace)													

coefplot r_cul_full, bylabel("Full" "sample") || r_cul_15, bylabel("+/-" "15 pp.") || r_cul_10, bylabel("+/-" "10 pp.") || r_cul_5, bylabel("+/-" "5 pp.") || r_cul_4, bylabel("+/-" "4 pp.") || r_cul_3, bylabel("+/-" "3 pp.") || r_cul_2, bylabel("+/-" "2 pp.") || r_cul_17, bylabel("+/-" "1.7 pp.") keep(1.left_above#c.crim) vertical yline(0, lpattern(dash)) bycoefs byopts(yrescale) ylabel(`cul',grid angle(h) labsize(small)) xlabel(,labsize(small)) levels(95 90) nokey mcolor(gs0) plotregion(lcolor(white)) ciopts(color(gs12 gs8)) scheme(s1mono) graphregion(color(white)) ytitle(Effect of left-wing majority on consistency, size(small)) title("Rightists") saving(_right_cul, replace) 														

gr combine _left_cul.gph _right_cul.gph, graphregion(color(white)) ycommon

*Figure D.5
gen run_gen = left_run if ideo_group==3
replace run_gen = right_run if ideo_group==1
gen treat = left_above if ideo_group==3
replace treat = right_above if ideo_group==1

foreach num of numlist 15 10 5 4 3 2 {
qui: reg anti_im treat##c.crim i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year run_gen c.run_gen#c.run_gen treat#c.run_gen treat#c.run_gen#c.run_gen, cluster(mun_id)	
estimate store pool_cul_full							

qui: reg anti_im treat##c.crim i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year run_gen c.run_gen#c.run_gen treat#c.run_gen treat#c.run_gen#c.run_gen if inrange(run_gen,-`num',`num'), cluster(mun_id)	
estimate store pool_cul_`num'	

qui: reg anti_im treat##c.crim i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year run_gen c.run_gen#c.run_gen treat#c.run_gen treat#c.run_gen#c.run_gen if inrange(run_gen,-1.7,1.7), cluster(mun_id)			
estimate store pool_cul_17
}

mylabels -0.1 (0.1) 0.3, format(%04.3f) clean local(cul_pool)
						
coefplot pool_cul_full, bylabel("Full" "sample") || pool_cul_15, bylabel("+/-" "15 pp.") || pool_cul_10, bylabel("+/-" "10 pp.") || pool_cul_5, bylabel("+/-" "5 pp.") || pool_cul_4, bylabel("+/-" "4 pp.") || pool_cul_3, bylabel("+/-" "3 pp.") || pool_cul_2, bylabel("+/-" "2 pp.") || pool_cul_17, bylabel("+/-" "1.7 pp.") keep(1.treat#c.crim) vertical yline(0, lpattern(dash)) bycoefs byopts(yrescale) ylabel(`cul_pool',grid angle(h) labsize(small)) xlabel(,labsize(small)) levels(95 90) nokey mcolor(gs0) plotregion(lcolor(white)) ciopts(color(gs12 gs8)) scheme(s1mono) graphregion(color(white)) ytitle(Effect of divergent majority on consistency, size(small)) title("Leftists and Rightists") saving(_pool_cul, replace)

*Table E.1
qui eststo l_runint: reg redis c.taxwel##c.right_above##c.right_run##c.right_run i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year if ideo_group==1, cluster(mun_id)						
estadd local bandwidth "Full sample", replace							
							
qui eststo r_runint: reg redis left_above##c.taxwel##c.left_run##c.left_run i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year if ideo_group==3, cluster(mun_id)
estadd local bandwidth "Full sample", replace	
																	
esttab l_runint r_runint, title(Interaction Between Running Variable and Welfare Spending) b(2) se starlevels(* 0.1 ** 0.05 *** 0.01) stats(bandwidth N, fmt(%9.0fc) label("Bandwidth" "Observations")) indicate("Covariates = *.inc" "Running variable = left_run right_run" "Running variable welfare spending interactions = c.taxwel#c.right_run c.taxwel#c.right_run#c.right_run c.taxwel#c.left_run c.taxwel#c.left_run#c.left_run") keep(taxwel 1.right_above 1.left_above 1.right_above#c.taxwel 1.left_above#c.taxwel _cons) label order(taxwel 1.right_above 1.left_above 1.right_above#c.taxwel 1.left_above#c.taxwel _cons)

*Figure E.1
foreach num of numlist 15 10 5 {
qui: reg redis right_above##c.taxwel right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run if ideo_group==1, cluster(mun_id)
estimate store l_nocov_full 							
							
qui: reg redis right_above##c.taxwel right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run if inrange(right_run,-`num',`num') & ideo_group==1, cluster(mun_id)							
estimate store l_nocov_`num'
						
qui: reg redis left_above##c.taxwel left_run c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run if ideo_group==3, cluster(mun_id)	
estimate store r_nocov_full 							
							
qui: reg redis left_above##c.taxwel left_run c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run if inrange(left_run,-`num',`num') & ideo_group==3, cluster(mun_id)	
estimate store r_nocov_`num'											
}						
							
mylabels 0 (0.05) 0.2, format(%04.3f) clean local(label_nocov)
						
coefplot l_nocov_full, bylabel("Full" "sample") || l_nocov_15, bylabel("+/-" "15 pp.") || l_nocov_10, bylabel("+/-" "10 pp.") || l_nocov_5, bylabel("+/-" "5 pp.") keep(1.right_above#c.taxwel) vertical yline(0, lpattern(dash)) bycoefs byopts(yrescale) ylabel(`label_nocov',grid angle(h) labsize(small)) xlabel(,labsize(small)) levels(95 90) nokey mcolor(gs0) plotregion(lcolor(white)) ciopts(color(gs12 gs8)) scheme(s1mono) graphregion(color(white)) ytitle(Effect of right-wing majority on consistency, size(small)) title("Leftists") saving(_left_nocov, replace)
													
coefplot r_nocov_full, bylabel("Full" "sample") || r_nocov_15, bylabel("+/-" "15 pp.") || r_nocov_10, bylabel("+/-" "10 pp.") || r_nocov_5, bylabel("+/-" "5 pp.") keep(1.left_above#c.taxwel)  vertical nolabels yline(0, lpattern(dash)) bycoefs byopts(yrescale) ylabel(`label_nocov', grid angle(h) labsize(small)) xlabel(,labsize(small)) levels(95 90) nokey plotregion(lcolor(white)) mcolor(gs0) ciopts(color(gs12 gs8)) scheme(s1mono) graphregion(color(white)) ytitle(Effect of left-wing majority on consistency, size(small)) title("Rightists") saving(_right_nocov, replace)	
							
gr combine _left_nocov.gph _right_nocov.gph, graphregion(color(white)) ycommon

*Figure E.2
foreach num of numlist 15 10 5 {
qui: reg redis right_above##c.taxwel i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run if ideo_group==1, absorb(mun_id) cluster(mun_id)			
estimate store l_fe_full							
							
qui: reg redis right_above##c.taxwel i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run if inrange(right_run,-`num',`num') & ideo_group==1, absorb(mun_id) cluster(mun_id)				
estimate store l_fe_`num'
						
qui: reg redis left_above##c.taxwel i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year left_run c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run if ideo_group==3, absorb(mun_id) cluster(mun_id)							
estimate store r_fe_full												
							
qui: reg redis left_above##c.taxwel i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year left_run c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run if inrange(left_run,-`num',`num') & ideo_group==3, absorb(mun_id) cluster(mun_id)							
estimate store r_fe_`num'
}
							
mylabels 0 (0.05) 0.2, format(%04.3f) clean local(fe_label)
							
coefplot l_fe_full, bylabel("Full" "sample") || l_fe_15, bylabel("+/-" "15 pp.") || l_fe_10, bylabel("+/-" "10 pp.") || l_fe_5, bylabel("+/-" "5 pp.") keep(1.right_above#c.taxwel) vertical yline(0, lpattern(dash)) bycoefs byopts(yrescale) ylabel(`fe_label',grid angle(h) labsize(small)) xlabel(,labsize(small)) levels(95 90) nokey mcolor(gs0) plotregion(lcolor(white)) ciopts(color(gs12 gs8)) scheme(s1mono) graphregion(color(white)) ytitle(Effect of right-wing majority on consistency, size(small)) title("Leftists") saving(fe_left, replace)
					
coefplot r_fe_full, bylabel("Full" "sample") || r_fe_15, bylabel("+/-" "15 pp.") || r_fe_10, bylabel("+/-" "10 pp.") || r_fe_5, bylabel("+/-" "5 pp.") keep(1.left_above#c.taxwel)  vertical nolabels yline(0, lpattern(dash)) bycoefs byopts(yrescale) ylabel(`fe_label', grid angle(h) labsize(small)) xlabel(,labsize(small)) levels(95 90) nokey plotregion(lcolor(white)) mcolor(gs0) ciopts(color(gs12 gs8)) scheme(s1mono) graphregion(color(white)) ytitle(Effect of left-wing majority on consistency, size(small)) title("Rightists") saving(fe_right, replace)
					
gr combine fe_left.gph fe_right.gph, graphregion(color(white)) ycommon	

*Figure E.3
foreach var of varlist inc sec_edu hig_edu occu male {							
replace `var'=. if `var'==99							
}							
							
mi set flong							
							
mi register imputed redis taxwel inc sec_edu hig_edu occu male age ideo_group							
mi register regular left_above right_above right_run left_run year							
mi impute chained (ologit, augment) inc (mlogit, augment) occu ideo_group (logit, augment) male sec_edu hig_edu (regress) age redis taxwel = left_above right_above right_run left_run year, add(4) rseed(1234) force						
							
mi estimate, dots: reg redis right_above##c.taxwel##ideo_group i.male##ideo_group c.age##c.age##ideo_group i.inc##ideo_group i.sec_edu##ideo_group i.hig_edu##ideo_group i.occu##ideo_group i.year##ideo_group c.right_run##ideo_group c.right_run#c.right_run##ideo_group right_above#c.right_run##ideo_group right_above#c.right_run#c.right_run##ideo_group, cluster(mun_id) 							
estimate store im_left_full							
							
mi estimate, dots: reg redis right_above##c.taxwel##ideo_group i.male##ideo_group c.age##c.age##ideo_group i.inc##ideo_group i.sec_edu##ideo_group i.hig_edu##ideo_group i.occu##ideo_group i.year##ideo_group c.right_run##ideo_group c.right_run#c.right_run##ideo_group right_above#c.right_run##ideo_group right_above#c.right_run#c.right_run##ideo_group if inrange(right_run,-15,15), cluster(mun_id) 							
estimate store im_left_15							
							
mi estimate, dots: reg redis right_above##c.taxwel##ideo_group i.male##ideo_group c.age##c.age##ideo_group i.inc##ideo_group i.sec_edu##ideo_group i.hig_edu##ideo_group i.occu##ideo_group i.year##ideo_group c.right_run##ideo_group c.right_run#c.right_run##ideo_group right_above#c.right_run##ideo_group right_above#c.right_run#c.right_run##ideo_group if inrange(right_run,-10,10), cluster(mun_id) 							
estimate store im_left_10							
							
mi estimate, dots: reg redis right_above##c.taxwel##ideo_group i.male##ideo_group c.age##c.age##ideo_group i.inc##ideo_group i.sec_edu##ideo_group i.hig_edu##ideo_group i.occu##ideo_group i.year##ideo_group c.right_run##ideo_group c.right_run#c.right_run##ideo_group right_above#c.right_run##ideo_group right_above#c.right_run#c.right_run##ideo_group if inrange(right_run,-5,5), cluster(mun_id)							
estimate store im_left_5							
							
mi estimate, dots: reg redis left_above##c.taxwel##ib(3).ideo_group i.male##ib(3).ideo_group c.age##c.age##ib(3).ideo_group i.inc##ib(3).ideo_group i.sec_edu##ib(3).ideo_group i.hig_edu##ib(3).ideo_group i.occu##ib(3).ideo_group i.year##ib(3).ideo_group c.left_run##ib(3).ideo_group c.left_run#c.left_run##ib(3).ideo_group left_above#c.left_run##ib(3).ideo_group left_above#c.left_run#c.left_run##ib(3).ideo_group, cluster(mun_id)							
estimate store im_right_full							
							
mi estimate, dots: reg redis left_above##c.taxwel##ib(3).ideo_group i.male##ib(3).ideo_group c.age##c.age##ib(3).ideo_group i.inc##ib(3).ideo_group i.sec_edu##ib(3).ideo_group i.hig_edu##ib(3).ideo_group i.occu##ib(3).ideo_group i.year##ib(3).ideo_group c.left_run##ib(3).ideo_group c.left_run#c.left_run##ib(3).ideo_group left_above#c.left_run##ib(3).ideo_group left_above#c.left_run#c.left_run##ib(3).ideo_group if inrange(left_run,-15,15), cluster(mun_id)							
estimate store im_right_15							
							
mi estimate, dots: reg redis left_above##c.taxwel##ib(3).ideo_group i.male##ib(3).ideo_group c.age##c.age##ib(3).ideo_group i.inc##ib(3).ideo_group i.sec_edu##ib(3).ideo_group i.hig_edu##ib(3).ideo_group i.occu##ib(3).ideo_group i.year##ib(3).ideo_group c.left_run##ib(3).ideo_group c.left_run#c.left_run##ib(3).ideo_group left_above#c.left_run##ib(3).ideo_group left_above#c.left_run#c.left_run##ib(3).ideo_group if inrange(left_run,-10,10), cluster(mun_id)							
estimate store im_right_10							
							
mi estimate, dots: reg redis left_above##c.taxwel##ib(3).ideo_group i.male##ib(3).ideo_group c.age##c.age##ib(3).ideo_group i.inc##ib(3).ideo_group i.sec_edu##ib(3).ideo_group i.hig_edu##ib(3).ideo_group i.occu##ib(3).ideo_group i.year##ib(3).ideo_group c.left_run##ib(3).ideo_group c.left_run#c.left_run##ib(3).ideo_group left_above#c.left_run##ib(3).ideo_group left_above#c.left_run#c.left_run##ib(3).ideo_group if inrange(left_run,-5,5), cluster(mun_id)							
estimate store im_right_5							
													
mylabels 0 (0.05) 0.2, format(%04.3f) clean local(mi_label) 							

coefplot im_left_full, bylabel("Full" "sample") || im_left_15, bylabel("+/-" "15 pp.") || im_left_10, bylabel("+/-" "10 pp.") || im_left_5, bylabel("+/-" "5 pp.") keep(1.right_above#c.taxwel) vertical yline(0, lpattern(dash)) bycoefs byopts(yrescale) ylabel(`mi_label',grid angle(h) labsize(small)) xlabel(,labsize(small)) levels(95 90) nokey mcolor(gs0) plotregion(lcolor(white)) ciopts(color(gs12 gs8)) scheme(s1mono) graphregion(color(white)) ytitle(Effect of right-wing majority on consistency, size(small)) title("Leftists") saving(mi_left, replace) replace							

coefplot im_right_full, bylabel("Full" "sample") || im_right_15, bylabel("+/-" "15 pp.") || im_right_10, bylabel("+/-" "10 pp.") || im_right_5, bylabel("+/-" "5 pp.") keep(1.left_above#c.taxwel)  vertical nolabels yline(0, lpattern(dash)) bycoefs byopts(yrescale) plotregion(lcolor(white)) ylabel(`mi_label', grid angle(h) labsize(small)) xlabel(,labsize(small)) levels(95 90) nokey mcolor(gs0) ciopts(color(gs12 gs8)) scheme(s1mono) graphregion(color(white)) ytitle(Effect of left-wing majority on consistency, size(small)) title("Rightists") saving(mi_right, replace) replace
				
gr combine mi_left.gph mi_right.gph, graphregion(color(white)) ycommon	
						
*Figure F.1
use "replication_data.dta", clear //Reloading data
drop if prop_zipmun<=0.8

gen ideo_right=0 if ideo_group!=.
replace ideo_right=1 if ideo_group==3
gen ideo_left=0 if ideo_group!=.
replace ideo_left=1 if ideo_group==1
gen party_left=0 if inrange(partyid,1,3)
replace party_left=1 if partyid==1
gen party_right=0 if inrange(partyid,1,3)
replace party_right=1 if partyid==2

pwcorr ideo_left party_left,sig obs //Correlation between left-wing ideology and left-wing party identification
pwcorr ideo_right party_right,sig obs //Correlation between right-wing ideology and right-wing party identification
			
foreach num of numlist 15 10 5/2 {							
qui: reg redis right_above##c.taxwel i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run if partyid==1, cluster(mun_id)							
estimate store l_party_full							
							
qui: reg redis right_above##c.taxwel i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run if inrange(right_run,-`num',`num') & partyid==1, cluster(mun_id)							
estimate store l_party_`num'

qui: reg redis right_above##c.taxwel i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run if inrange(right_run,-1.7,1.7) & partyid==1, cluster(mun_id)							
estimate store l_party_17
						
qui: reg redis left_above##c.taxwel i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year left_run c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run if partyid==2, cluster(mun_id)							
estimate store r_party_full							
							
qui: reg redis left_above##c.taxwel i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year left_run c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run if inrange(left_run,-`num',`num') & partyid==2, cluster(mun_id)							
estimate store r_party_`num'	

qui: reg redis left_above##c.taxwel i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year left_run c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run if inrange(left_run,-1.7,1.7) & partyid==2, cluster(mun_id)							
estimate store r_party_17											
}
													
mylabels -0.4 (0.1) 0.4, format(%04.3f) clean local(party)
							
coefplot l_party_full, bylabel("Full" "sample") || l_party_15, bylabel("+/-" "15 pp.") || l_party_10, bylabel("+/-" "10 pp.") || l_party_5, bylabel("+/-" "5 pp.") || l_party_4, bylabel("+/-" "4 pp.") || l_party_3, bylabel("+/-" "3 pp.") || l_party_2, bylabel("+/-" "2 pp.") || l_party_17, bylabel("+/-" "1.7 pp.") keep(1.right_above#c.taxwel) vertical yline(0, lpattern(dash)) bycoefs byopts(yrescale) ylabel(`party',grid angle(h) labsize(small)) xlabel(,labsize(small)) levels(95 90) nokey mcolor(gs0) ciopts(color(gs12 gs8)) scheme(s1mono) plotregion(lcolor(white)) graphregion(color(white)) ytitle(Effect of right-wing majority on consistency, size(small)) title("Left-wing party identifiers") saving(_left_party, replace)							
							
coefplot r_party_full, bylabel("Full" "sample") || r_party_15, bylabel("+/-" "15 pp.") || r_party_10, bylabel("+/-" "10 pp.") || r_party_5, bylabel("+/-" "5 pp.") || r_party_4, bylabel("+/-" "4 pp.") || r_party_3, bylabel("+/-" "3 pp.") || r_party_2, bylabel("+/-" "2 pp.") || r_party_17, bylabel("+/-" "1.7 pp.") keep(1.left_above#c.taxwel) vertical nolabels yline(0, lpattern(dash)) bycoefs byopts(yrescale) ylabel(`party', grid angle(h) labsize(small)) xlabel(,labsize(small)) levels(95 90) nokey mcolor(gs0) ciopts(color(gs12 gs8)) plotregion(lcolor(white)) scheme(s1mono) graphregion(color(white)) ytitle(Effect of left-wing majority on consistency, size(small)) title("Right-wing party identifiers") saving(_right_party, replace)
						
gr combine _left_party.gph _right_party.gph, graphregion(color(white)) ycommon		

*Figure F.2
foreach num of numlist 15 10 5/3 {
qui: reg ideo right_above right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year if ideo_group==1, cluster(mun_id)	
estimate store l_pers_full							
							
qui: reg ideo right_above right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year if inrange(right_run,-`num',`num') & ideo_group==1, cluster(mun_id)							
estimate store l_pers_`num'	

qui: reg ideo right_above right_run i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year if inrange(right_run,-2,2) & ideo_group==1, cluster(mun_id) //A linear running variable is used due to collinearity							
estimate store l_pers_2	

qui: reg ideo right_above right_run c.right_run#c.right_run right_above#c.right_run right_above#c.right_run#c.right_run i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year if inrange(right_run,-1.7,1.7) & ideo_group==1, cluster(mun_id)							
estimate store l_pers_17											
						
qui: reg ideo left_above left_run c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year if ideo_group==3, cluster(mun_id)				
estimate store r_pers_full							
							
qui: reg ideo left_above left_run c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year if inrange(left_run,-`num',`num') & ideo_group==3, cluster(mun_id)							
estimate store r_pers_`num'

qui: reg ideo left_above left_run i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year if inrange(left_run,-2,2) & ideo_group==3, cluster(mun_id) //A linear running variable is used due to collinearity					
estimate store r_pers_2

qui: reg ideo left_above left_run c.left_run#c.left_run left_above#c.left_run left_above#c.left_run#c.left_run i.male c.age##c.age i.inc i.sec_edu i.hig_edu i.occu i.year if inrange(left_run,-1.7,1.7) & ideo_group==3, cluster(mun_id)							
estimate store r_pers_17											
}	
							
mylabels -0.4 (0.1) 0.4, format(%04.3f) clean local(pers)
						
coefplot l_pers_full, bylabel("Full" "sample") || l_pers_15, bylabel("+/-" "15 pp.") || l_pers_10, bylabel("+/-" "10 pp.") || l_pers_5, bylabel("+/-" "5 pp.") || l_pers_4, bylabel("+/-" "4 pp.") || l_pers_3, bylabel("+/-" "3 pp.") || l_pers_2, bylabel("+/-" "2 pp.") || l_pers_17, bylabel("+/-" "1.7 pp.") keep(right_above) vertical yline(0, lpattern(dash)) bycoefs byopts(yrescale) ylabel(`pers',grid angle(h) labsize(small)) xlabel(,labsize(small)) levels(95 90) nokey mcolor(gs0) ciopts(color(gs12 gs8)) plotregion(lcolor(white)) scheme(s1mono) graphregion(color(white)) ytitle(Effect of right-wing majority on left-right position, size(small)) title("Leftists") saving(_left_persuasion, replace)
					
coefplot r_pers_full, bylabel("Full" "sample") || r_pers_15, bylabel("+/-" "15 pp.") || r_pers_10, bylabel("+/-" "10 pp.") || r_pers_5, bylabel("+/-" "5 pp.") || r_pers_4, bylabel("+/-" "4 pp.") || r_pers_3, bylabel("+/-" "3 pp.") || r_pers_2, bylabel("+/-" "2 pp.") || r_pers_17, bylabel("+/-" "1.7 pp.") keep(left_above) vertical nolabels yline(0, lpattern(dash)) bycoefs byopts(yrescale) ylabel(`pers', angle(h) grid labsize(small)) xlabel(,labsize(small)) levels(95 90) nokey mcolor(gs0) ciopts(color(gs12 gs8)) plotregion(lcolor(white)) scheme(s1mono) graphregion(color(white)) ytitle(Effect of left-wing majority on left-right position, size(small)) title("Rightists") saving(_right_persuasion, replace) 
													
gr combine _left_persuasion.gph _right_persuasion.gph, graphregion(color(white)) ycommon	


*** Municipality-level analyses ***							

*Reading data
use "mun_data.dta", clear
					
*Table C.2
foreach var of varlist mun_pop mun_age0_29 mun_non_west mun_fam_inc {
qui eststo r_`var': reg `var' right_above##c.right_run##c.right_run if inrange(right_run,-10,10), cluster(mun_id)
estadd local bandwidth "+/- 10 pp.", replace
}

foreach var of varlist old_mun right_above_lag1 {
qui eststo r_`var': logit `var' right_above##c.right_run##c.right_run if inrange(right_run,-10,10), cluster(mun_id)
estadd local bandwidth "+/- 10 pp.", replace
}

esttab r_mun_pop r_mun_age0_29 r_mun_non_west r_mun_fam_inc r_old_mun r_right_above_lag1, title(Municipality Level Covariate Analysis: Right-Wing Majority) b(2) se starlevels(* 0.1 ** 0.05 *** 0.01) stats(bandwidth N, fmt(%9.0fc) label("Bandwidth" "Observations")) indicate("Running variable = right_run") keep(1.right_above _cons) label order(1.right_above _cons) replace

*Table C.3
foreach var of varlist mun_pop mun_age0_29 mun_non_west mun_fam_inc {
qui eststo l_`var': reg `var' left_above##c.left_run##c.left_run if inrange(left_run,-10,10), cluster(mun_id)
estadd local bandwidth "+/- 10 pp.", replace	
}

foreach var of varlist old_mun left_above_lag1 {
qui eststo l_`var': logit `var' left_above##c.left_run##c.left_run if inrange(left_run,-10,10), cluster(mun_id)
estadd local bandwidth "+/- 10 pp.", replace
}

esttab l_mun_pop l_mun_age0_29 l_mun_non_west l_mun_fam_inc l_old_mun l_left_above_lag1, title(Municipality Level Covariate Analysis: Left-Wing Majority) b(2) se starlevels(* 0.1 ** 0.05 *** 0.01) stats(bandwidth N, fmt(%9.0fc) label("Bandwidth" "Observations")) indicate("Running variable = left_run") keep(1.left_above _cons) label order(1.left_above _cons) replace

*Figure C.2
DCdensity seat_right, breakpoint(50) generate(Xj Yj r0 fhat se_fhat)

drop Xj Yj r0 fhat se_fhat			

*Figure C.3			
DCdensity seat_left, breakpoint(50) generate(Xj Yj r0 fhat se_fhat)